package artid.com.arttogoa.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import artid.com.arttogoa.R;
import artid.com.arttogoa.parser.CategoryList;


public class ZxCateAdapter extends BaseAdapter {
	private Context mContext;
	LayoutInflater mInflater;
	ViewHolder holder;
	List<CategoryList> listdata;

	public ZxCateAdapter(Context mContext) {
		this.mContext = mContext;
		listdata = new ArrayList<CategoryList>();
		mInflater = LayoutInflater.from(mContext);
	}

	public void setdata(List<CategoryList> listdata) {
		this.listdata = listdata;
		notifyDataSetChanged();
	}

	@Override
	public int getCount() {
		return listdata.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder vh = null;
		if (convertView == null) {
			vh = new ViewHolder();
			convertView = mInflater.inflate(R.layout.item_zx_cate, null);
			vh.tittle = (TextView) convertView.findViewById(R.id.text_zx_cate);
			convertView.setTag(vh);
		} else {
			vh = (ViewHolder) convertView.getTag();
		}
		CategoryList item = listdata.get(position);
		vh.tittle.setText(item.getTitle());

		return convertView;
	}

	class ViewHolder {
		TextView tittle;
	}

}
